# ===================================================================================
#  The XRPrimer CMake configuration file
#
#             ** File generated automatically, do not modify **
#
#  Usage from an external project:
#    In your CMakeLists.txt, add these lines:
#
#    find_package(XRPrimer REQUIRED)
#    target_link_libraries(MY_TARGET_NAME XRPrimer::XRPrimer)
#
#
# ===================================================================================

### Initialisation performed by CONFIGURE_PACKAGE_CONFIG_FILE:
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)

list(APPEND CMAKE_PREFIX_PATH "${PACKAGE_PREFIX_DIR}/share/eigen3/cmake")
list(APPEND CMAKE_PREFIX_PATH "${PACKAGE_PREFIX_DIR}/lib/cmake/Ceres/")
list(APPEND CMAKE_PREFIX_PATH "${PACKAGE_PREFIX_DIR}/lib64/cmake/Ceres/")
list(APPEND CMAKE_PREFIX_PATH "${PACKAGE_PREFIX_DIR}/lib/cmake/jsoncpp")
list(APPEND CMAKE_PREFIX_PATH "${PACKAGE_PREFIX_DIR}/lib64/cmake/jsoncpp")
list(APPEND CMAKE_PREFIX_PATH "${PACKAGE_PREFIX_DIR}/lib/cmake/spdlog")
list(APPEND CMAKE_PREFIX_PATH "${PACKAGE_PREFIX_DIR}/lib64/cmake/spdlog")

find_dependency(Eigen3 REQUIRED CONFIG)
find_dependency(Ceres REQUIRED CONFIG)
find_dependency(jsoncpp REQUIRED CONFIG)
find_dependency(spdlog REQUIRED CONFIG)


if(NOT IOS)
  set(_OpenCV_MAJOR_VERSION @OPENCV_VERSION_MAJOR@)
  if(NOT _OpenCV_MAJOR_VERSION)
    set(_OpenCV_MAJOR_VERSION 4)
  endif()

  if(_OpenCV_MAJOR_VERSION GREATER 3)
    set(OpenCV_DIR "${PACKAGE_PREFIX_DIR}/lib/cmake/opencv4")
  else()
    set(OpenCV_DIR "${PACKAGE_PREFIX_DIR}/share/OpenCV")
  endif()

  find_dependency(OpenCV REQUIRED CONFIG)
  if(NOT TARGET Opencv::OpenCV)
    add_library(OpenCV::OpenCV INTERFACE IMPORTED GLOBAL)
    target_link_libraries(OpenCV::OpenCV INTERFACE ${OpenCV_LIBS})
    target_include_directories(OpenCV::OpenCV INTERFACE ${OpenCV_INCLUDE_DIRS})
  endif()
else()
    message(STATUS "finding opencv framework")
    set(opencv_framework_path ${PACKAGE_PREFIX_DIR}/framework)
    if(EXISTS ${opencv_framework_path}/opencv2.framework)
      add_library(OpenCV::OpenCV INTERFACE IMPORTED GLOBAL)
      target_compile_options(OpenCV::OpenCV INTERFACE -framework opencv2 -F${opencv_framework_path} $<$<COMPILE_LANGUAGE:CXX>:-Wno-unused-command-line-argument>)
      target_link_libraries(OpenCV::OpenCV INTERFACE "-framework opencv2")
      target_link_options(OpenCV::OpenCV INTERFACE "-F${opencv_framework_path}")
    else()
      message(FATAL "opencv framework not found")
    endif()
endif()

if(NOT IOS)
  set(PnpSolver_DIR "${PACKAGE_PREFIX_DIR}/lib/cmake")
  find_dependency(PnpSolver REQUIRED CONFIG)
endif()

IF(NOT TARGET XRPrimer::xrprimer)
  INCLUDE("${CMAKE_CURRENT_LIST_DIR}/xrprimer-targets.cmake")
ENDIF()
